<?php

/**
 * Cli 基础
 * @date 	2019-04-21
 */

namespace app\common\controller;

use think\Controller;

class Clibase extends Controller
{
    public function initialize()
    {
        header("Content-type:text/html;charset=utf-8");

        $php_sapi_name = php_sapi_name();
        $cli_eheck     = env('CLI_CHECK');
        $cli_eheck     = isset($cli_eheck) ? $cli_eheck : true;
        if ($php_sapi_name != 'cli' && $cli_eheck === true) {
            $this->error('非法访问', '/');
        }
    }


}
